package com.zheng.oss.rpc.service.impl;

import com.zheng.common.annotation.BaseService;
import com.zheng.common.base.BaseServiceImpl;
import com.zheng.oss.dao.mapper.OssFileStackMapper;
import com.zheng.oss.dao.model.OssFileStack;
import com.zheng.oss.rpc.api.OssFileService;
import com.zheng.oss.rpc.api.OssFileStackService;
import com.zheng.oss.rpc.api.OssRoleFileService;
import com.zheng.upms.rpc.api.UpmsApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author likun
 * @since 2018-05-09
 */
@Service
@Transactional(rollbackFor = Exception.class)
@BaseService
public class OssFileStackServiceImpl extends BaseServiceImpl<OssFileStackMapper, OssFileStack> implements OssFileStackService {
    @Autowired
    private UpmsApiService apiService;
    @Autowired
    private OssFileService fileService;
    @Autowired
    private OssRoleFileService roleFileService;

    @Override
    public OssFileStack insertFileStack(OssFileStack fileStack) {
        insert(fileStack);
        return fileStack;
    }

    public boolean deleteFile(Integer fileId, Integer fileStackId) throws Exception {
        return deleteById(fileStackId) && fileService.deleteById(fileId);
    }
}
